<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">
	<ui:define name="content">
		<f:view>
			<h:form>
				<h:messages id="myError" />
				<br />
				<h:commandButton class="button" value="#{msg.BU_viewNotificationHistory_backButton}"
					style="align-left:20px; align-right:auto;"
					actionListener="#{userPageBean.setPage('createNotification')}"></h:commandButton>
				<h:outputText value="&lt;br/&gt;" escape="false" />
				<h:outputText value="&lt;br/&gt;" escape="false" />
				<h:outputText value="Notification History:" rendered="#{notificationBean.tickets.rowCount gt 0}"/>
				<h:outputText value="No Tickets in Notification History." rendered="#{notificationBean.tickets.rowCount eq 0}"/>
				<h:outputText value="&lt;br/&gt;" escape="false" />

				<h:dataTable id="dataTabel" class="table"
					value="#{notificationBean.tickets}" var="res" border="1"
					rendered="#{notificationBean.tickets.rowCount gt 0}" width="100%"> 
					<h:column>
						<f:facet class="th" name="header" >
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_curNumber}"></h:outputText>
						</f:facet>
						<h:outputText class="td"
							value="#{notificationBean.tickets.rowIndex + 1}"></h:outputText>
					</h:column>
					<h:column>
						<f:facet class="th" name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_ticketID}"></h:outputText>
						</f:facet>
						<h:outputText class="td" value="#{res.ticketId}"></h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_resource}"></h:outputText>
						</f:facet>
						<h:outputText value="#{res.resourceName}"></h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_problemType}"></h:outputText>
						</f:facet>
						<h:outputText value="#{res.problemType}"></h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_description}"></h:outputText>
						</f:facet>
						<h:inputTextarea value="#{res.ticketDescription}" disabled="true"></h:inputTextarea>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_status}"></h:outputText>
						</f:facet>
						<h:outputText value="#{res.status}"></h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_date}"></h:outputText>
						</f:facet>
						<h:outputText value="#{res.ticketDate}">
							<f:convertDateTime pattern="dd.MM.yyyy" />
						</h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_response}"></h:outputText>
						</f:facet>
						<h:inputTextarea disabled="true" value="#{res.reponseDescription}">
						</h:inputTextarea>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_responder}"></h:outputText>
						</f:facet>
						<h:outputText disabled="true" value="#{res.responderName}">
						</h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_table_responseDate}"></h:outputText>
						</f:facet>
						<h:outputText value="#{res.responseDate}">
							<f:convertDateTime pattern="dd.MM.yyyy" />
						</h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.BU_viewNotificationHistory_selectOp}"></h:outputText>
						</f:facet>
						<h:commandButton class="button" value="#{msg.BU_viewNotificationHistory_sendButton}"
							rendered="#{res.status eq 'Saved'}"
							actionListener="#{notificationBean.updateNotification}">
							<f:attribute name="idTicket" value="#{res.ticketId}"></f:attribute>
						</h:commandButton>
						<h:commandButton class="trashBtn" value="#{msg.BU_viewNotificationHistory_deleteButton}"
							onclick="if (! confirm('Are you sure you want to delete this?') ) { return false;}; return true;"
							actionListener="#{notificationBean.deleteNotification}"
							rendered="#{res.status eq 'Saved'}">
							<f:attribute name="idTicket" value="#{res.ticketId}"></f:attribute>
						</h:commandButton>
					</h:column>
				
				</h:dataTable>

			</h:form>

		</f:view>
	</ui:define>
</ui:composition>

</html>